// 计算斐波那契数列
fn fibnacci(i: usize) -> u32 {
    if i < 3 {
        (i - 1) as u32
    } else {
        fibnacci(i - 1) + fibnacci(i - 2)
    }
}


pub fn odd_fibnacci_sum(threshold: u32) -> u32 {
    let mut sum: u32 = 0;
    for i in 1.. {
        let v = fibnacci(i);
        // 当斐波那契数小于阈值且为奇数时，累加至 sum
        if v < threshold {
            if v % 2 != 0 {
                sum += v;
            }
        } else {
            break;
        }
    }
    sum
}
